const express = require('express');
const cors = require('cors');
const app = express();

app.use(cors()); // 允许所有来源
// 或者
// app.use(cors({ origin: 'http://localhost:8080' })); // 允许特定来源

app.get('/posts/getUrl', (req, res) => {
  res.json({ message: 'This is CORS-enabled for only your site.' });
});

app.listen(8088, () => {
  console.log('Server is running on port 8088');
});
